# 创建数据表+参数

from flask import Flask
from flask_sqlalchemy import SQLAlchemy
import pymysql

app = Flask(__name__)
app.config["SQLALCHEMY_DATABASE_URI"] = 'mysql+pymysql://root:root@localhost/blog'
# app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///" + "./sql.db"
app.config["SQLALCHEMY_TRACK_MODIFICATIONS"] = False
app.config["SECRET)KEY"] = "32K4HK32H4BK2GJ2BV554eh445324562t3g3h3hHG34"

db = SQLAlchemy(app)

# 创建user表
class User(db.Model):
    __tablename__ = "user"
    id = db.Column(db.Integer, primary_key=True)
    username = db.Column(db.String(64), nullable=False)
    password = db.Column(db.String(64), nullable=False)

# 创建文章表
class Article(db.Model):
    __tablename__ = "article"
    id = db.Column(db.Integer, primary_key=True)
    title = db.Column(db.String(100), nullable=False)
    post =  db.Column(db.String(255), nullable=False)
    time =  db.Column(db.String(64), nullable=False)


if __name__ == '__main__':
    app.run()